home *** CD-ROM | disk | FTP | other *** search
- /* Help.c */
- /* Created 930503 10:02 AM by AppMaker */
-
- #include <Types.h>
- #include <Quickdraw.h>
- #include <Controls.h>
- #include <Dialogs.h>
- #include <Events.h>
- #include <Lists.h>
- #include <Menus.h>
- #include <Resources.h>
- #include <TextEdit.h>
- #include <ToolUtils.h>
- #include "ResourceDefs.h"
- #include "TE32K.h"
- #include "Globals.h"
- #include "Miscellany.h"
- #include "Scrolling.h"
- #include "WindowAids.h"
- #include "C14CalculatorData.h"
- #include "GetMyHelpProc.h"
- #include "Help.h"
-
- #define List1 1
- #define Field2 2
- #define Scroll3 3
-
- void HelpSeg(void) {}
-
- static void BuildList1 (void);
-
- /*----------*/
- static void BuildList1 ()
- {
- Rect bounds;
-
- SetWFont (List1);
- GetWRect (List1, &bounds);
- cur->List1HandleHelp = NewV1List (bounds, qd.thePort); /* NewV1List in WindowAids.c */
-
- GetMyHelpList(cur->List1HandleHelp);
-
- /* AddToList ("\pOne", cur->List1HandleHelp); /* AddToList in WindowAids.c »*/
- /* AddToList ("\pTwo", cur->List1HandleHelp);*/
- /* AddToList ("\pThree", cur->List1HandleHelp);*/
- /* AddToList ("\pInfinity", cur->List1HandleHelp);*/
-
- LDoDraw (true, cur->List1HandleHelp);
-
- } /*BuildList1*/
-
-
- /*----------*/
- WindowPtr OpenHelp (Str255 fName,
- short vRefNum,
- short fRefNum)
- {
- WindowPtr newWindow;
- Rect bounds;
-
- newWindow = GetWindow (HelpID);
- if (fName [0] != 0) {
- SetWTitle (newWindow, fName);
- }
- SetPort (newWindow);
- SetNewInfo (newWindow);
- cur->vScroll = nil;
- cur->hScroll = nil;
- cur->fileNum = fRefNum;
- cur->volNum = vRefNum;
- cur->dirty = false;
- cur->filename = NewString (fName);
- cur->windowKind = WHelp;
- ((WindowPeek) curWindow)->windowKind = userKind + WHelp;
- cur->witlHandle = GetResource ('Witl', HelpID);
- cur->wictHandle = GetResource ('Wict', HelpID);
-
- BuildList1 ();
-
- SetWFont (Field2);
- GetWRect (Field2, &bounds);
- cur->Field2Handle = TENew (&bounds, &bounds);
- TESetJust (textJust, cur->Field2Handle);
- TEAutoView (true, cur->Field2Handle);
- cur->Scroll3Handle = GetNewControl (130, newWindow);
-
- cur->text = cur->Field2Handle;
-
- ShowWindow (newWindow);
-
- return(newWindow);
-
- } /*OpenHelp*/
-
- /*----------*/
- void CloseHelp (void);
- void CloseHelp (void)
- {
- LDispose (cur->List1HandleHelp);
- TEDispose (cur->Field2Handle);
-
- DisposHandle ((Handle) cur->filename);
- DiscardInfo (curWindow);
- } /*CloseHelp*/
-
- /*----------*/
- void ControlHelp (ControlHandle whichControl,
- short whichPart,
- Point where);
- void ControlHelp (ControlHandle whichControl,
- short whichPart,
- Point where)
- {
- Rect bounds;
-
- if ((whichControl == (**(cur->List1HandleHelp)).vScroll)
- || (whichControl == (**(cur->List1HandleHelp)).hScroll)) {
- if (LClick (where, 0, cur->List1HandleHelp)) {
- /*double click in scroll bar*/
- }
- }
- if (whichControl == cur->Scroll3Handle) {
- TrackScroll (cur->Scroll3Handle, whichPart, where, nil);
- }
-
- } /*ControlHelp*/
-
- /*----------*/
- void MouseInHelp (Point where,
- short modifiers);
- void MouseInHelp (Point where,
- short modifiers)
- {
- Rect bounds;
-
- if (PtInRect (where, &(**(cur->List1HandleHelp)).rView)) {
- if (LClick (where, modifiers, cur->List1HandleHelp)) {
- /*double click*/
- }
- if (GetListChoice (&cur->List1ChoiceHelp, cur->List1HandleHelp)) {
- /* something is selected */
- }
- }
- if (PtInRect (where, &(**(cur->Field2Handle)).viewRect)) {
- if (cur->text != nil) {
- TEDeactivate (cur->text);
- }
- cur->text = cur->Field2Handle;
- TEActivate (cur->text);
- TEClick (where, false, cur->text);
- }
-
- } /*MouseInHelp*/
-
- /*----------*/
- void TypeInHelp (char ch);
- void TypeInHelp (char ch)
- {
- if (cur->text == nil) {
- SysBeep (1);
- } else {
- TEKey (ch, cur->text);
- cur->dirty = true;
- }
- } /*TypeInHelp*/
-
- /*----------*/
- void UpdateHelp (void);
- void UpdateHelp (void)
- {
- Rect bounds;
-
- SetWFont (List1);
- LUpdate (qd.thePort->visRgn, cur->List1HandleHelp);
- bounds = (**(cur->List1HandleHelp)).rView;
- InsetRect (&bounds, -1, -1);
- FrameRect (&bounds);
-
- TEUpdate (&qd.thePort->portRect, cur->Field2Handle);
-
- DrawClippedGrow (-15, -15);
- } /*UpdateHelp*/
-
- /*----------*/
- /*void ActivateHelp (Boolean activate)*/
- /*{*/
- /* LActivate (activate, cur->List1HandleHelp);*/
- /* EnableControl (cur->Scroll3Handle, activate);*/
- /* */
- /* DrawClippedGrow (-15, -15);*/
- /*} /*ActivateHelp*/
-
- /*----------*/
- void ResizeHelp (void);
- void ResizeHelp (void)
- {
- /* application-specific code to resize items in window */
- } /*ResizeHelp*/
-
- /*----------*/
- pascal void ScrollHelp (short newValue,
- short oldValue);
- pascal void ScrollHelp (short newValue,
- short oldValue)
- {
- /* application-specific code to scroll window */
- } /*ScrollHelp*/
-
- /* Help */
-